Defaults id_column to None for PIGs & tests#141
Merged
patrickleonardy merged 3 commits intodevelopfrom Jan 10, 2023
Merged
Conversation
patrickleonardy
commented
Dec 5, 2022
| class TestPigTablesGeneration: | ||
|
|
||
| @pytest.mark.parametrize("id_col_name", [None, "col_id"]) # test None as this is the default value in generate pig tabels | ||
| def test_col_id(self, id_col_name): |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| def test_col_id(self, id_col_name): | |
| def test_col_id(self, id_col_name: str | None): |
This is only possible for python 3.10 and above. I am wondering should I use this or the older version by importing typing and using typing.Union[str, None] for backwards compatibility reasons ? Or how does that actually work ?
Contributor
There was a problem hiding this comment.
You could use Optional instead, which has the same functionality as Union, but is more readable.
Suggested change
| def test_col_id(self, id_col_name): | |
| def test_col_id(self, id_col_name: Optional[str]): |
patrickleonardy
commented
Dec 5, 2022
| 'avg_target': [0.0, 0.5, 1.0, 0.0, 0.6666666666666666, 0.0, 1.0, 0.0] | ||
| }) | ||
|
|
||
| pd.testing.assert_frame_equal(out, expected) No newline at end of file |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| pd.testing.assert_frame_equal(out, expected) | |
| pd.testing.assert_frame_equal(out, expected) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Story title
Remove mandatory id column #135
Changes made
Altered the calculate_pig_table & generate_pig_tables method such that the column_id_name is no longer needed, it was not really needed for the calculations in the background anyway.
Added a test in order to check if it still gives back the same results than before.
How does the solution address the problem
This PR provides the column_id_name by default with None. In that way, the Data scientist can just forget about the column_ID and the code still is backwards compatible.
Linked issues
Resolves #135